Repository navigation
fix(forms): return pending form handoffs as non-error results - #3896
Shanmukh-l33t wants to merge 1 commit into
Conversation
Hosts treat isError results as failed tool calls and exclude them from MCP App rendering, so the deferred create_pull_request, update_pull_request, and issue_write forms never appeared. The pending handoff is now a normal result that keeps its stop message and awaiting_user_submission status. Handler content is preserved so modern clients keep the stop message in text instead of replacing it with the structured JSON.
There was a problem hiding this comment.
🔵 Needs a closer look
The pending-write success/error contract spans middleware, host rendering, and agent continuation, requiring human validation of the handoff and final-result lifecycle beyond server-side assertions.
No open issues 🎉
What changed in this PR
This PR addresses the server-side form-rendering blocker in #3666 by returning pending MCP App form handoffs as non-error results. It preserves explicit pending status and stop messages without changing when forms are shown or how submissions execute.
Changes:
- Return non-error handoffs for issue creation/updates and pull request creation/updates.
- Preserve handler text so modern clients retain the stop message alongside structured pending status.
- Update regression tests and error-handling documentation for the revised contract.
| File | Description |
|---|---|
pkg/utils/result.go |
Return pending form handoffs with IsError: false. |
pkg/utils/result_test.go |
Add coverage for non-error handoffs, text, and pending status. |
pkg/github/typed_consolidated_pull_request_outputs_test.go |
Assert non-error pull request handoffs and preserved text. |
pkg/github/typed_consolidated_issue_outputs_test.go |
Assert non-error issue handoffs and preserved text. |
pkg/github/pullrequests.go |
Preserve handler text when deferring pull request writes. |
pkg/github/pullrequests_test.go |
Update form-routing assertions and explanatory comments. |
pkg/github/issues.go |
Preserve deferred issue-write text and clarify the result contract. |
pkg/github/issues_test.go |
Expect non-error results across issue form-routing cases. |
docs/error-handling.md |
Document pending forms as non-error results, not completed mutations. |
Review effort: Balanced (adaptive)
IrynaKulakova
left a comment
There was a problem hiding this comment.
The pending-form handoff retains its explicit awaiting-submission status and stop message while returning a non-error result, allowing MCP App rendering. Focused issue and PR handoff tests pass. Approval is based on server-side behavior; live Codex rendering and submission remain unverified.
Summary
Deferred form handoffs for
create_pull_request,update_pull_request, andissue_writewere returned withIsError: true. Hosts treat error results as failed tool calls and exclude them from MCP App rendering, so users never saw the form. This is the server side blocker described in #3666.utils.NewToolResultAwaitingFormSubmissionnow returns a non-error result. The pending state stays explicit in the stop message and instructuredContentasstatus: "awaiting_user_submission"plus its reason.Testing
TestNewToolResultAwaitingFormSubmissionIsNotAnErrorfails on the old helper (Should be false) and passes after the change.TestTypedIssueWriteAwaitingForm,TestTypedPullRequestWriteAwaitingForm,Test_IssueWrite_MCPAppsFeature_UIGate,Test_CreatePullRequest_MCPAppsFeature_UIGate,Test_UpdatePullRequest_MCPAppsFeature_UIGate.go build ./...,go vet ./...,golangci-lint run ./pkg/utils/... ./pkg/github/...all clean.go test ./... -p 2passed.Scope
This changes the result contract only. It does not alter when deferral happens, the form contents, or the submission path. Hosts still need to render and deliver the form, and genuinely failed tool calls still return
isError: true.Fixes #3666
Prepared with AI assistance and verified by the author.